<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>项目合同复制</title>
</head>
<script type="text/html" id="layui-row">
    <div class="layui-row" id="{0}" >
        <div class="layui-form-item tg-l" >
            <div class="layui-inline">
                <label class="layui-form-label" style="color:red;">子项名称</label>
                <div class="layui-input-inline">
                    <input type="text" id="{0}subName" name="subNames" placeholder="请输入" lay-verify="required" maxlength="20"  autocomplete="off" class="layui-input subNames" >
                </div>
            </div>
            <div class="layui-inline" ><button type="button" class="layui-btn layui-btn-sm del-layui-row" title="删除子项"  ><i class="layui-icon">&#xe640;</i></button></div>
        </div>
        <div class="contract-box" >
            <div class="contract-money">
                <table class="layui-table">
                    <colgroup>
                        <col width="90">
                        <col width="200">
                        <col width="200">
                        <col width="200">
                        <col width="200">
                        <col width="200">
                    </colgroup>
                    <tbody>
                    <tr>
                        <td></td>
                        <td>子项小计</td>
                        <td><input type="text" id="{0}amountbefore"  value="" name="outPreDownAmountSubs" readonly lay-verify="required|floatNumber" style="border:0px" autocomplete="off" class="layui-input amountbefore" /></td>
                        <td><input type="text" id="{0}discount"      value="" name="outPreDownRateSubs" readonly lay-verify="required|floatNumber" style="border:0px" autocomplete="off" class="layui-input discount" /></td>
                        <td><input type="text" id="{0}amountafter"   value="" name="outAfterDownAmountSubs" readonly lay-verify="required|floatNumber" style="border:0px" autocomplete="off" class="layui-input amountafter" /></td>
                        <td></td>
                    </tr>
                    </tbody>
                    <tbody>
                    <tr>
                        <th>序号</th>
                        <th>费用类型</th>
                        <th>对外下浮前金额（元）</th>
                        <th>对外下浮率（%）</th>
                        <th>对外下浮后金额（元）</th>
                        <th></th>
                    </tr>
                    </tbody>
                    <tbody >
                    <tr id="{0}Row-1" level=1 >
                        <td><span class="label" >1</span> <input type="hidden" value="1" name="orderIdxs" /><input type="hidden" value="6" name="xv" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><b>建安工程费</b><input type="hidden" value="1" name="feeTypes" /><input type="hidden" value="-1" name="feeSmallTypes" /><input type="hidden" value=""  name="itemNameSub"  class="itemNameSub" /><input type="hidden" value="建安工程费" name="typeNames"  /></td>
                        <td><input type="text" readonly style="border:0px" name="outPreDownAmountDetials" autocomplete="off" class="layui-input amountbefore" /></td>
                        <td><input type="text" readonly style="border:0px" name="outPreDownRateDetials" readonly autocomplete="off" class="layui-input decimal discount" /></td>
                        <td><input type="text" readonly style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input amountafter" /></td>
                        <td><button type="button" class="layui-btn layui-btn-sm add-sub-row" >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="sub{0}Row-1.1"  level=2 >
                        <td><span class="label">1.1</span> <input type="hidden" value="1.1" name="orderIdxs" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><label>土建</label><input type="hidden" value="1" name="feeTypes" /><input type="hidden" value="" name="itemNameSub"  class="itemNameSub" /><input type="hidden" value="1.1" name="feeSmallTypes" /><input type="hidden" value="土建" name="typeNames"   /></td>
                        <td><input type="text"  lay-verify="required|floatNumber" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="text"  lay-verify="required|floatNumber" name="outPreDownRateDetials" autocomplete="off" class="layui-input decimal discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
                        <td><button type="button" class="layui-btn layui-btn-sm add-sub-row" >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="sub{0}Row-1.2"  level=2>
                        <td><span class="label">1.2</span> <input type="hidden" value="1.2" name="orderIdxs" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><label>安装</label><input type="hidden" value="1" name="feeTypes" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub" /><input type="hidden" value="1.2" name="feeSmallTypes" /><input type="hidden" value="安装" name="typeNames"  /></td>
                        <td><input type="text" lay-verify="required|floatNumber" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="text" lay-verify="required|floatNumber" name="outPreDownRateDetials" autocomplete="off" class="layui-input decimal discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
                        <td><button type="button" class="layui-btn layui-btn-sm add-sub-row" >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="{0}Row-2"  level=1>
                        <td><span class="label">2</span> <input type="hidden" value="2" name="orderIdxs" /><input type="hidden" value="6" name="xv" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><b>预备费</b><input type="hidden" value="2" name="feeTypes" /><input type="hidden" value="-1" name="feeSmallTypes" /><input type="hidden" value="" name="itemNameSub"  class="itemNameSub" /><input type="hidden" value="预备费" name="typeNames" /></td>
                        <td><input type="text" lay-verify="required|floatNumber" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials"  class="discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
                        <td><button type="button"
                                    class="layui-btn layui-btn-sm add-sub-row"  >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="{0}Row-3"  level=1>
                        <td><span class="label">3</span><input type="hidden" value="3" name="orderIdxs" /><input type="hidden" value="6" name="xv" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><b>建设工程其他费</b><input type="hidden" value="3" name="feeTypes" /><input type="hidden" value="-1" name="feeSmallTypes" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub" /><input type="hidden" value="建设工程其他费" name="typeNames"  /></td>
                        <td><input type="text" readonly style="border:0px" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials"  class="discount" /></td>
                        <td><input type="text" readonly style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input amountafter" /></td>
                        <td><button type="button" class="layui-btn layui-btn-sm add-sub-row"  >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="sub{0}Row-3.1"  level=2>
                        <td><span class="label">3.1</span> <input type="hidden" value="3.1" name="orderIdxs" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><label>建设单位管理费</label><input type="hidden" value="3" name="feeTypes" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub"  /><input type="hidden" value="3.1" name="feeSmallTypes" /><input type="hidden" value="建设单位管理费" name="typeNames" /></td>
                         <td><input type="text" lay-verify="required|floatNumber" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials"  class="discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
                        <td><button type="button" class="layui-btn layui-btn-sm add-sub-row" >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="sub{0}Row-3.2"  level=2>
                        <td><span class="label" >3.2</span><input type="hidden" value="3.2" name="orderIdxs" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><label>政府代付费</label><input type="hidden" value="3" name="feeTypes" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub" /><input type="hidden" value="3.2" name="feeSmallTypes" /><input type="hidden" value="政府代付费" name="typeNames" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials"  class="discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input amountafter" /></td>
                        <td><button type="button" class="layui-btn layui-btn-sm add-sub-row" >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="sub{0}Row-3.2.1"  level=3>
                        <td><span class="label">3.2.1</span><input type="hidden" value="3.2.1" name="orderIdxs" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><input type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input typeNames" name="typeNames" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub"   /><input type="hidden" value="3" name="feeTypes" /><input type="hidden" value="3.2" name="feeSmallTypes" /></td>
                        <td><input type="text" lay-verify="required|floatNumber" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials" class="discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
                        <td></td>
                    </tr>
                    <tr id="sub{0}Row-3.3"  level=2>
                        <td><span class="label" >3.3</span><input type="hidden" value="3.3" name="orderIdxs" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><label>项目前期费</label><input type="hidden" value="3" name="feeTypes" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub" /><input type="hidden" value="3.3" name="feeSmallTypes" /><input type="hidden" value="项目前期费" name="typeNames" /></td>
                        <td><input type="text" readonly style="border:0px" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials"  class="discount" /></td>
                        <td><input type="text" readonly style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
                        <td><button type="button" class="layui-btn layui-btn-sm add-sub-row" >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="sub{0}Row-3.3.1"  level=3 >
                        <td><span class="label">3.3.1</span><input type="hidden" value="3.3.1" name="orderIdxs" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><label>征地拆迁费</label><input type="hidden" value="3" name="feeTypes" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub" /><input type="hidden" value="3.3" name="feeSmallTypes" /><input type="hidden" value="征地拆迁费" name="typeNames" /></td>
                        <td><input type="text" lay-verify="required|floatNumber" value="" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials"  class="discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
                        <td></td>
                    </tr>
                    <tr id="{0}Row-4"  level=1>
                        <td><span class="label">4</span> <input type="hidden" value="4" name="orderIdxs" /><input type="hidden" value="6" name="xv" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><b>建设期利息</b><input type="hidden" value="4" name="feeTypes" /><input type="hidden" value="-1" name="feeSmallTypes" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub" /><input type="hidden" value="建设期利息" name="typeNames" /></td>
                        <td><input type="text" lay-verify="required|floatNumber" value="" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials"  class="discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
                        <td><button type="button" class="layui-btn layui-btn-sm add-sub-row" >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="{0}Row-5"  level=1>
                        <td><span class="label">5</span><input type="hidden" value="5" name="orderIdxs" /><input type="hidden" value="6" name="xv" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><b>设备及工器具购置</b><input type="hidden"  value="5" name="feeTypes" /><input type="hidden" value="-1" name="feeSmallTypes" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub" /><input type="hidden" value="设备及工器具购置" name="typeNames" /></td>
                        <td><input type="text" lay-verify="required|floatNumber" value="" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials"  class="discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
						<td><button type="button" class="layui-btn layui-btn-sm add-sub-row"  >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    <tr id="{0}Row-6"  level=1>
                        <td><span class="label" >6</span><input type="hidden" value="6" name="orderIdxs" /><input type="hidden" value="6" name="xv" /><input type="hidden" value="{0}" name="contractSubId" /></td>
                        <td><b>铺底流动资金</b><input type="hidden" value="6" name="feeTypes" /><input type="hidden" value="-1" name="feeSmallTypes" /><input type="hidden" value="" name="itemNameSub" class="itemNameSub" /><input type="hidden" value="铺底流动资金" name="typeNames" /></td>
                        <td><input type="text" lay-verify="required|floatNumber" value="" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
                        <td><input type="hidden" value="0" name="outPreDownRateDetials"  class="discount" /></td>
                        <td><input type="text" readonly lay-verify="required|floatNumber" style="border:0px" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input  amountafter" /></td>
                        <td><button type="button" class="layui-btn layui-btn-sm add-sub-row" >
                            <i class="layui-icon">&#xe654;</i>
                        </button></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</script>

<script type="text/html" id="layui-row-tr" >
<tr id="{0}" level={1} >
<td><span class="label" >{2}</span><input type="hidden" value="{2}" name="orderIdxs" /><input type="hidden" value="{3}" name="contractSubId" /></td>
<td><input type="text" lay-verify="required" value="{4}" maxlength="50" autocomplete="off" class="layui-input typeNames" name="typeNames" />
<input type="hidden" value="{7}" name="feeTypes" class="feeTypes" />
<input type="hidden" value="{8}" name="feeSmallTypes" class="feeSmallTypes" />
<input type="hidden" value="{9}" name="itemNameSub" class="itemNameSub" />
</td>
<td><input type="text" lay-verify="required|floatNumber" value="{5}" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>
<td><input type="hidden" value="{6}" name="outPreDownRateDetials"  class="discount layui-input decimal" /></td>
<td><input type="text"  value="{10}" readonly style="border:0px" lay-verify="required|floatNumber" name="outAfterDownAmountDetials" autocomplete="off" class="layui-input amountafter" /></td>
<td>
<button type="button" class="layui-btn layui-btn-sm del-sub-row" ><i class="layui-icon">&#xe640;</i></button>
<button type="button" class="layui-btn layui-btn-sm add-sub-row" ><i class="layui-icon">&#xe654;</i></button></td>
</tr>
</script>

<style>
.layui-input-block p,
.layui-input-inline p {
	display: block;
	height: 38px;
	line-height: 38px;
	padding-left:10px;
	color: black !important;
}

#contract-breakdown {
	cursor: pointer;
}

#contract-investment-info .layui-inline .layui-form-label {
	position: relative;
	text-align: left;
}

#contract-investment-info .layui-inline:nth-child(1) .layui-form-label {
	left: 160px;
}

#contract-investment-info .layui-inline:nth-child(2) .layui-form-label {
	left: 120px;
}

#contract-investment-info .layui-inline:nth-child(3) .layui-form-label {
	left: 115px;
}

.margin-lt10 {
	margin-left: 10px;
}

.layui-row+.layui-row {
	margin-top: 36px;
}

.tg-l {
	text-align: left;
}

.tg-c {
	text-align: center;
}

.tg-r {
	text-align: right;
}

.contract-list {
	margin-top: 20px;
}

.contract-box {
	width: 100%;
	min-height: 100px;
}

.contract-money {
	width: 90%;
	margin: 0 auto;
}

.contract-money .layui-table {
	margin: 0;
}

.contract-money th {
	text-align: center;
	height: 38px;
}

.contract-money .label {
	display: block;
	width: 45px !important;
	text-align: left;
	margin-left: 15px;
}

.fieldset {
	margin-top: 5px;
	margin-bottom: 0px
}

.layui-legend {
	background-color: #5fb878;
	font-size: 15px !important;
	width: 140px;
}

.layui-form-item {
	margin-bottom: 5px;
	clear: both;
	*zoom: 1;
}

.layui-form-label {
	width: 160px;
}

</style>
<body>
	<div class="layui-fluid">
		<div class="layui-card">
			<div style="padding-top: 15px;">&nbsp;</div>
			<form class="layui-form" id="addInfo_form" lay-filter="addInfo_form">
				<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
					<ul class="layui-tab-title">
						<li lay-id="0" class="layui-this"><B>总合同</B></li>
						<li lay-id="1"><B>合同清单</B></li>
					</ul>
					<div class="layui-tab-content">
						<div class="layui-tab-item layui-show">
							<fieldset class="layui-elem-field layui-field-title fieldset"
								id="baseInfo">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">项目基础信息></legend>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">申请公司</label>
										<div class="layui-input-inline">
											<input type="hidden" name="hrOrgid" value="${bindOrgId}">
											<input type="text" value="${bindOrgName}"
												style="border: 0px;width:280px" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">申请部门</label>
										<div class="layui-input-inline">
											<input type="hidden" name="hrDeptid" value="${bindDeptId}">
											<input type="text" value="${bindDeptName}"
												style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">申请人</label>
										<div class="layui-input-inline">
											<input type="hidden" name="hrStaffApplyid"
												value="${SESSION_KEY_USER_DETAIL.hrStaffId }"> <input
												type="text" name="staffname" value="${proContract.staffName }"
												readonly="readonly" style="border: 0px" autocomplete="off"
												class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">项目名称</label>
										<div class="layui-input-inline">
											<input type="text" id="add_select_proId" name="proName" value="${proContract.proName}" maxlength="100" style="border: 0px;width:280px" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">项目编号</label>
										<div class="layui-input-inline">
											<input type="hidden" id="id_code" name="proCodeAndCodes" value ="${proContract.proCode}_${proContract.id}_${proContract.proName }">
											<input type="text" name="proCode" value="${proContract.proCode}" style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">区域公司</label>
										<div class="layui-input-inline">
											<input type="hidden" name="hrOrgAreaId" value="${proContract.hrOrgAreaId}">
											<input type="text" name="orgAreaName" value="${proContract.orgAreaName}" style="border: 0px;width:220px" readonly="readonly" class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">项目公司</label>
										<div class="layui-input-inline">
											<input type="hidden" name="hrOrgProId"  value="${proContract.hrOrgProId}">
											<input type="text" name="orgProName" value="${proContract.orgProName}" style="border: 0px;width:280px" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">实施机构</label>
										<div class="layui-input-inline">
											<input type="text" name="carryOrg" value="${proContract.carryOrg}" style="border: 0px;width:280px" readonly="readonly" class="layui-input">
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">项目地址</label>
										<div class="layui-input-inline">
											<input type="hidden" name="sgCityId" value="${proContract.sgCityId}">
											<input type="text" name="sgCityName" value="${proContract.sgCityName}" style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">项目负责人</label>
										<div class="layui-input-inline">
											<input type="text" name="proLeader" value="${proContract.proLeader}"
												maxlength="10" lay-verify="required|COC" autocomplete="off"
												class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">项目合同名称</label>
										<div class="layui-input-inline">
											<input type="text" name="contractName" value="${proContract.contractName}"
												maxlength="100" lay-verify="required|COC"
												autocomplete="off" class="layui-input">
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">项目合同编码（选填）</label>
										<div class="layui-input-inline">
											<input type="text" name="contractNo" value="${proContract.contractNo}"
												maxlength="50" autocomplete="off" class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">合同签订日期（选填）</label>
										<div class="layui-input-inline">
											<input type="text" class="layui-input" id="sent-laydate-start" name="signDate" readonly
												value="<fmt:formatDate value="${proContract.signDate }" pattern="yyyy-MM-dd"/>" autocomplete="off">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">计价方式</label>
										<div class="layui-input-inline">
											<select name="valueMode" lay-verify="required">
								      			<option value="">请选择-计价方式</option>
								      			<option value="1" <c:if test="${proContract.valueMode == '1'}">selected</c:if>>清单</option>
								      			<option value="2" <c:if test="${proContract.valueMode == '2'}">selected</c:if>>定额</option>
												<option value="3" <c:if test="${proContract.valueMode == '3'}">selected</c:if>>固定总价</option>
								      			<option value="4" <c:if test="${proContract.valueMode == '4'}">selected</c:if>>其它</option>
											</select>
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">调价方式</label>
									<div class="layui-input-block">
										<textarea name="riseMode" class="layui-textarea" maxlength="500" lay-verify="required"
											style="width:899px; height:90px;" >${proContract.riseMode}</textarea>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">业态</label>
										<div class="layui-input-inline">
											<select name="bizType" lay-verify="required">
								      			<option value="">请选择-业态</option>
								      			<option value="1" <c:if test="${proContract.bizType == '1'}">selected</c:if>>公路</option>
								      			<option value="2" <c:if test="${proContract.bizType == '2'}">selected</c:if>>市政</option>
												<option value="3" <c:if test="${proContract.bizType == '3'}">selected</c:if>>铁路</option>
								      			<option value="4" <c:if test="${proContract.bizType == '4'}">selected</c:if>>房建</option>
								      			<option value="5" <c:if test="${proContract.bizType == '5'}">selected</c:if>>棚改</option>
								      			<option value="6" <c:if test="${proContract.bizType == '6'}">selected</c:if>>学校</option>
												<option value="7" <c:if test="${proContract.bizType == '7'}">selected</c:if>>综合</option>
								      			<option value="8" <c:if test="${proContract.bizType == '8'}">selected</c:if>>医疗及养老</option>
								      			<option value="9" <c:if test="${proContract.bizType == '9'}">selected</c:if>>土地増减挂钩</option>
											</select>
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">是否入库</label>
										<div class="layui-input-inline">
											<select name="isInStore" lay-verify="required">
								      			<option value="">请选择-入库情况</option>
								      			<option value="0" <c:if test="${proContract.isInStore == '0'}">selected</c:if>>未入库</option>
								      			<option value="1" <c:if test="${proContract.isInStore == '1'}">selected</c:if>>已入库</option>
											</select>
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">回报机制</label> 
										<input type="hidden" name="backMech" value="${proContract.backMech }">
							      		<div class="layui-input-inline">
								      		<input type="checkbox" name="backMechName" <c:if test="${fn:contains(proContract.backMech, '1')}" >checked</c:if> value="1" title="政府付费" lay-skin="primary">
							      		</div>
							      		<div class="layui-input-inline">
											<input type="checkbox" name="backMechName" <c:if test="${fn:contains(proContract.backMech, '2')}" >checked</c:if> value="2" title="可行性缺口补助" lay-skin="primary"> 
							      		</div>
							      		<div class="layui-input-inline">
											<input type="checkbox" name="backMechName" <c:if test="${fn:contains(proContract.backMech, '3')}" >checked</c:if> value="3" title="使用者付费" lay-skin="primary"> 
							      		</div>
									</div>
								</div>
								<div class="layui-form-item" >
									<div class="layui-inline" >
										<label class="layui-form-label" >合同建设期（年）</label>
										<div class="layui-input-inline" >
											<input type="text" id="id_Contractconstructionperiodyear" name="buildYears"
												onblur="checkValueverifyNumber2(this);" lay-verify="required|floatNumber" maxlength="100"
												value="${proContract.buildYears}" autocomplete="off" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" >合同运营期（年）</label>
										<div class="layui-input-inline" >
											<input type="text" id="id_Contractoperationperiodyear" name="omYears"
												onblur="checkValueverifyNumber2(this);" maxlength="100" lay-verify="required|floatNumber"
												value="${proContract.omYears}" autocomplete="off" class="layui-input">
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">总合同期（年）</label>
										<div class="layui-input-inline">
											<input type="text" id="id_Totalcontractperiodyear" name="totalYears"
												onblur="checkValueverifyNumber2(this);" maxlength="100" lay-verify="required|floatNumber"
												value="${proContract.totalYears}" autocomplete="off" class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">合同建设期（天）</label>
										<div class="layui-input-inline">
											<input type="text" id="id_Contractconstructionperioddays" name="buildDays"
												readonly="readonly" maxlength="100" lay-verify="required|COC"
												value="${proContract.buildDays}" style="border: 0px;" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">合同运营期（天）</label>
										<div class="layui-input-inline">
											<input type="text" id="id_Contractoperationperioddays" name="omDays"
												readonly="readonly" maxlength="100" lay-verify="required|COC"
												value="${proContract.omDays}" style="border: 0px;" class="layui-input">
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">总合同期（天）</label>
										<div class="layui-input-inline">
											<input type="text" id="id_Totalcontractperioddays" name="totalDays"
												readonly="readonly" maxlength="100" lay-verify="required|COC"
												value="${proContract.totalDays}" style="border: 0px;" class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">合同开工日期</label>
										<div class="layui-input-inline">
											<input type="text" class="layui-input" id="id_contractCommencementDate"
												name="beginBuildDate" readonly lay-verify="required"
												value="<fmt:formatDate value="${proContract.beginBuildDate }" pattern="yyyy-MM-dd"/>" autocomplete="off">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">建安竣工日期</label>
										<div class="layui-input-inline">
											<input type="text" class="layui-input" id="id_completionDateOfConstructionAndinstallation"
												name="endCaeDate" readonly lay-verify="required"
												value="<fmt:formatDate value="${proContract.endCaeDate }" pattern="yyyy-MM-dd"/>" autocomplete="off">
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">运营结束日期</label>
										<div class="layui-input-inline">
											<input type="text" class="layui-input" lay-verify="required"
												id="id_operationEndDate" name="endOmDate" readonly
												value="<fmt:formatDate value="${proContract.endOmDate }" pattern="yyyy-MM-dd"/>" autocomplete="off">
										</div>
									</div>
								</div>
							</fieldset>
							<fieldset class="layui-elem-field layui-field-title fieldset" id="baseInfo">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">合同投资信息></legend>
								<div class="layui-form-item" >
									<div class="layui-inline" style="float:right" >
										<label class="layui-form-label" id="contract-breakdown" style="color:#01AAED;">编辑合同分解清单</label>
										<div class="layui-input-inline">
											<input type="text" name="showInx" value="" readonly="readonly" style="border: 0px" class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">序号</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">费用名称</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">金额（元）</label>
										<div class="layui-input-inline"></div>
									</div>
								</div>
							</fieldset>
							<fieldset class="layui-elem-field layui-field-title fieldset"
								id="contract-investment-info">
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">1</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">建安工程费</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="caeFeeLabel">${proContract.proContractInvest.caeFee}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="caeFeeId" name="caeFee" value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label"></label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label " style="left: 130px;">*建安下浮率（综合）</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="caeDownRateLabel">${proContract.proContractInvest.caeDownRate}%</label>
										<div class="layui-input-inline">
											<input type="hidden" id="caeDownRateId" name="caeDownRate"
												value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label"></label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" style="left: 130px;">*建安占比</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="caeRateLabel">${proContract.proContractInvest.caeRate}%</label>
										<div class="layui-input-inline">
											<input type="hidden" id="caeRateId" name="caeRate" value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">2</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">预备费</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="prepareFeeLabel">${proContract.proContractInvest.prepareFee}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="prepareFeeId" name="prepareFee"
												value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">3</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">建安工程其他费</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="buildOtherFeeLabel">${proContract.proContractInvest.buildOtherFee}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="buildOtherFeeId"
												name="buildOtherFee" value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">3.1</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">建设单位管理费</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="buildOrgFeeLabel">${proContract.proContractInvest.buildOrgFee}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="buildOrgFeeId" name="buildOrgFee"
												value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">3.2</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">政府代付费</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="gdReplaceFeeLabel">${proContract.proContractInvest.gdReplaceFee}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="gdReplaceFeeId" name="gdReplaceFee"
												value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">3.3</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">项目前期费</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="preFeeLabel">${proContract.proContractInvest.preFee}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="preFeeId" name="preFee" value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">3.3.1</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">征地拆迁费</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="moveFeeLabel">${proContract.proContractInvest.moveFee}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="moveFeeId" name="moveFee" value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">4</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">建设期利息</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="buildInterestLabel">${proContract.proContractInvest.buildInterest}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="buildInterestId"
												name="buildInterest" value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">5</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">设备及工器具购置</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="buyFeeLabel">${proContract.proContractInvest.buyFee}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="buyFeeId" name="buyFee" value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">6</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">铺底流动资金</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="flowFeeLabel">${proContract.proContractInvest.flowFee}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="flowFeeId" name="flowFee" value="" />
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<hr class="layui-bg-gray">
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label"></label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">投资合计</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label" id="totalSumLabel">${proContract.proContractInvest.totalSum}</label>
										<div class="layui-input-inline">
											<input type="hidden" id="totalSumId" name="totalSum" value="" />
										</div>
									</div>
								</div>
							</fieldset>

							<fieldset class="layui-elem-field layui-field-title fieldset"
								id="baseInfo">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">商务指标></legend>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">银行融资资金（元）</label>
										<div class="layui-input-inline">
											<input type="text" id="bankFundId" name="bankFund" value="${proContract.bankFund}"
												maxlength="13" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat3();arabiaToCN(this,1);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">银行融资资金占比（%）</label>
										<div class="layui-input-inline">
											<input type="text" id="bankFundPercentId" name="bankFundPercent" value="${proContract.bankFundPercent}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												style="border: 0px;" readonly class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">自有资本金（元）</label>
										<div class="layui-input-inline">
											<input type="text" id="selfFundId" name="selfFund" value="${proContract.selfFund}"
												maxlength="13" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat3();arabiaToCN(this,1);" class="layui-input">
										</div>
									</div>

								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">自有资本金占比（%）</label>
										<div class="layui-input-inline">
											<input type="text" id="selfFundPercentId" name="selfFundPercent" value="${proContract.selfFundPercent}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												style="border: 0px;" readonly class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">政府资本金（元）</label>
										<div class="layui-input-inline">
											<input type="text" id="gdFundId" name="gdFund" value="${proContract.gdFund}"
												maxlength="13" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat3();arabiaToCN(this,1);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">政府资本金占比（%）</label>
										<div class="layui-input-inline">
											<input type="text" id="gdFundPercentId" name="gdFundPercent" value="${proContract.gdFundPercent}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												style="border: 0px;" readonly class="layui-input">
										</div>
									</div>

								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">自有资本金回报率（%)</label>
										<div class="layui-input-inline">
											<input type="text" name="selfBackRate"
												value="${proContract.selfBackRate}" maxlength="20"
												lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">建设期融资利率（%)</label>
										<div class="layui-input-inline">
											<input type="text" name="buildCapRate"
												value="${proContract.buildCapRate}" maxlength="20"
												lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">银行融资回报率（%)</label>
										<div class="layui-input-inline">
											<input type="text" name="bankBackRate"
												value="${proContract.bankBackRate}" maxlength="20"
												lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>

								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">年运营绩效服务费（元）</label>
										<div class="layui-input-inline">
											<input type="text" name="perOmFee"
												value="${proContract.perOmFee}" maxlength="13"
												lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);arabiaToCN(this,1);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">折现率（%)</label>
										<div class="layui-input-inline">
											<input type="text" name="cashRate" value="${proContract.cashRate}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">投资回报率（%)</label>
										<div class="layui-input-inline">
											<input type="text" name="investBackRate" value="${proContract.investBackRate}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>

								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">年兜底运营收入（元）</label>
										<div class="layui-input-inline">
											<input type="text" name="perBottomOmIncome" value="${proContract.perBottomOmIncome}"
												maxlength="13" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);arabiaToCN(this,1);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">年兜底运营成本（元）</label>
										<div class="layui-input-inline">
											<input type="text" name="perBottomOmCost"
												value="${proContract.perBottomOmCost}" maxlength="13"
												lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);arabiaToCN(this,1);" class="layui-input">
										</div>
									</div>

								</div>

							</fieldset>
							<fieldset class="layui-elem-field layui-field-title fieldset"
								id="baseInfo">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">公式信息></legend>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">名称</label>
										<div class="layui-input-inline"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">计算公式说明</label>
										<div class="layui-input-inline" style="width:150px;"></div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">参数详细说明</label>
										<div class="layui-input-inline" style="width:50px;"></div>
									</div>
								</div>
								<div class="layui-form-item">
									<!-- 灰色分割线-->
									<hr class="layui-bg-gray">
								</div>
								<c:forEach items="${proContract.proContractUlas }"
									var="detail">
									<div class="layui-form-item">
										<div class="layui-inline">
											<label class="layui-form-label"> 
												<c:if test="${detail.formulaType == '1' }">
													<c:out value="可用性服务费" />
													<input type="hidden" name="formulaTypes" value="1"/>
												</c:if> 
												<c:if test="${detail.formulaType == '2' }">
													<c:out value="政策处理费" />
													<input type="hidden" name="formulaTypes" value="2"/>
												</c:if> 
												<c:if test="${detail.formulaType == '3' }">
													<c:out value="使用者服务费" />
													<input type="hidden" name="formulaTypes" value="3"/>
												</c:if> 
												<c:if test="${detail.formulaType == '4' }">
													<c:out value="可行性缺口补助（选填）" />
													<input type="hidden" name="formulaTypes" value="4"/>
												</c:if> 
												<c:if test="${detail.formulaType == '5' }">
													<c:out value="运营维护费（选填）" />
													<input type="hidden" name="formulaTypes" value="5"/>
												</c:if> 
												<c:if test="${detail.formulaType == '6' }">
													<c:out value="一次性支付 " />
													<input type="hidden" name="formulaTypes" value="6"/>
												</c:if>
											</label>
											<div class="layui-input-inline"></div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label" style="width: 55px;"></label>
											<div class="layui-input-inline">
												<textarea name="formulaMemos" class="layui-textarea" maxlength="250"  autocomplete="off"
													<c:if test="${detail.formulaType == '1'|| detail.formulaType == '2'|| detail.formulaType == '3'|| detail.formulaType == '6'}">lay-verify="required"</c:if> 
													style="width: 200px; min-height: 20px;">${detail.formulaMemo}</textarea>
											</div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label" style="width:120px;"></label>
											<div class="layui-input-inline">
												<textarea name="paraMemos" class="layui-textarea" maxlength="250"  autocomplete="off"
													<c:if test="${detail.formulaType == '1'|| detail.formulaType == '2'|| detail.formulaType == '3'|| detail.formulaType == '6'}">lay-verify="required"</c:if>
													style="width: 200px; min-height: 20px;">${detail.paraMemo}</textarea>
											</div>
										</div>
									</div>
								</c:forEach>
							</fieldset>
							<fieldset class="layui-elem-field layui-field-title fieldset">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">投标信息 ></legend>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">投标综合利润（万元）</label>
										<div class="layui-input-inline">
											<input type="text" name="investTotalProfit" style="border: 0px;"
												value="${proContract.investTotalProfit}" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">综合利润率(%)</label>
										<div class="layui-input-inline">
											<input type="text" name="multiRate" style="border: 0px;"
												value="${proContract.multiRate}" readonly="readonly" class="layui-input">
										</div>
									</div>

								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">投标边界条件说明>></label>
										<div class="layui-input-inline">
											<input type="text" value="0" style="border: 0px;"
												readonly="readonly" class="layui-input" />
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label"></label>
										<div class="layui-input-inline"></div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label"></label>
										<div class="layui-input-inline"></div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">项目资本金占比(%)</label>
										<div class="layui-input-inline">
											<input type="text" name="capitalPercent" value="${proContract.capitalPercent}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">政府出资比例（%）</label>
										<div class="layui-input-inline">
											<input type="text" name="gdProvidePercent" value="${proContract.gdProvidePercent}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">银行融资成本利率（%）</label>
										<div class="layui-input-inline">
											<input type="text" name="bankCapInterest" value="${proContract.bankCapInterest}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">自有资金成本利率（%）</label>
										<div class="layui-input-inline">
											<input type="text" name="selfCostInterest" value="${proContract.selfCostInterest}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">各种保函费用利率（%）</label>
										<div class="layui-input-inline">
											<input type="text" name="etcInterest" value="${proContract.etcInterest}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">融资通道费（万元）</label>
										<div class="layui-input-inline">
											<input type="text" name="capChannelFee" value="${proContract.capChannelFee}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);arabiaToCN(this,2);" class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">工程成本下浮率（%）</label>
										<div class="layui-input-inline">
											<input type="text" name="costDownRate" value="${proContract.costDownRate}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">工程承揽下浮率（%）</label>
										<div class="layui-input-inline">
											<input type="text" name="hireDownRate" value="${proContract.hireDownRate}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>

									<div class="layui-inline">
										<label class="layui-form-label">居间人承揽工程量</label>
										<div class="layui-input-inline">
											<input type="text" name="midHire" value="${proContract.midHire}"
												maxlength="20" autocomplete="off" lay-verify="required" class="layui-input">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">居间人承揽项目下浮率（%）</label>
										<div class="layui-input-inline">
											<input type="text" name="midHireDownRate" value="${proContract.midHireDownRate}"
												maxlength="20" lay-verify="required|floatNumber" autocomplete="off"
												onblur="isNumberAndFloat2(this);" class="layui-input">
										</div>
									</div>

								</div>
							</fieldset>
							<fieldset class="layui-elem-field layui-field-title fieldset">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">其他说明 ></legend>
								<div class="layui-form-item">
									<label class="layui-form-label" style="width: 150px;">建设期绩效考核说明</label>
									<div class="layui-input-block">
										<textarea name="buildKpiMemo" class="layui-textarea" maxlength="500"
											lay-verify="required" style="width: 899px; height: 90px;">${proContract.buildKpiMemo}</textarea>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label" style="width: 150px;">运营期绩效考核说明</label>
									<div class="layui-input-block">
										<textarea name="omKipMemo" class="layui-textarea" maxlength="500"
											lay-verify="required" style="width: 899px; height: 90px;">${proContract.omKipMemo}</textarea>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label" style="width: 150px;">主要调整内容描述（相对于招标文件、投标文件）</label>
									<div class="layui-input-block">
										<textarea name="mainMemo" class="layui-textarea" maxlength="500"
											lay-verify="required" style="width: 899px; height: 90px;">${proContract.mainMemo}</textarea>
									</div>
								</div>
							</fieldset>
							<fieldset class="layui-elem-field layui-field-title fieldset"
								id="baseInfo">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">附件></legend>
								<div style="margin-top: 20px;">
									<div class="layui-form-item">
										<label class="layui-form-label" style="width: 350px;">支持pdf、excel、word、图片资料，可上传多个</label>
									</div>
									<div class="layui-form-item">
									    <label class="layui-form-label">Word版合同文本</label>
									    <div class="layui-input-block">
									    	<div class="layui-upload">
								              	<button type="button" class="layui-btn" id="1-upload-more">上传</button>
						                		<div class="layui-upload-list" id="1-upload-more-list">
						                			<c:forEach items="${proContract.proContractAtts }" var="fileAtt">
								              			<c:if test="${fileAtt.types == '1' }">
								              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
								              					<c:choose>
									              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
										              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:when>
										              				<c:otherwise>
										              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:otherwise>
								              					</c:choose>
								              					<div class="mask">
								              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
								              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
								              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtts1" ></input>
								              					</div>
								              					<p>${fileAtt.fileName}</p>
								              				</div>
								              			</c:if>
								              		</c:forEach>
						                		</div>
								            </div>
									    </div>
								  	</div>
									<div class="layui-form-item">
									    <label class="layui-form-label">PDF版合同文本</label>
									    <div class="layui-input-block">
									    	<div class="layui-upload">
								              	<button type="button" class="layui-btn" id="2-upload-more">上传</button>
						                		<div class="layui-upload-list" id="2-upload-more-list">
						                			<c:forEach items="${proContract.proContractAtts }" var="fileAtt">
								              			<c:if test="${fileAtt.types == '2' }">
								              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
								              					<c:choose>
									              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
										              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:when>
										              				<c:otherwise>
										              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:otherwise>
								              					</c:choose>
								              					<div class="mask">
								              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
								              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
								              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtts2" ></input>
								              					</div>
								              					<p>${fileAtt.fileName}</p>
								              				</div>
								              			</c:if>
								              		</c:forEach>
						                		</div>
								            </div>
									    </div>
								  	</div>
									<div class="layui-form-item">
									    <label class="layui-form-label">盖章版合同文本（选填）</label>
									    <div class="layui-input-block">
									    	<div class="layui-upload">
								              	<button type="button" class="layui-btn" id="3-upload-more">上传</button>
						                		<div class="layui-upload-list" id="3-upload-more-list">
						                			<c:forEach items="${proContract.proContractAtts }" var="fileAtt">
								              			<c:if test="${fileAtt.types == '3' }">
								              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
								              					<c:choose>
									              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
										              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:when>
										              				<c:otherwise>
										              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:otherwise>
								              					</c:choose>
								              					<div class="mask">
								              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
								              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
								              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtts3" ></input>
								              					</div>
								              					<p>${fileAtt.fileName}</p>
								              				</div>
								              			</c:if>
								              		</c:forEach>
						                		</div>
								            </div>
									    </div>
								  	</div>
									<div class="layui-form-item">
									    <label class="layui-form-label">其他附件（选填）</label>
									    <div class="layui-input-block">
									    	<div class="layui-upload">
								              	<button type="button" class="layui-btn" id="4-upload-more">上传</button>
						                		<div class="layui-upload-list" id="4-upload-more-list">
						                			<c:forEach items="${proContract.proContractAtts }" var="fileAtt">
								              			<c:if test="${fileAtt.types == '4' }">
								              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
								              					<c:choose>
									              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
										              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:when>
										              				<c:otherwise>
										              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
										              				</c:otherwise>
								              					</c:choose>
								              					<div class="mask">
								              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
								              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
								              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtts4" ></input>
								              					</div>
								              					<p>${fileAtt.fileName}</p>
								              				</div>
								              			</c:if>
								              		</c:forEach>
						                		</div>
								            </div>
									    </div>
								  	</div>
									
								</div>
							</fieldset>

						</div>
						<div class="layui-tab-item">
							<fieldset class="layui-elem-field layui-field-title fieldset">
								<legend class="layui-btn layui-legend"
									style="text-align: left; cursor: default;">基础信息></legend>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">项目名称</label>
										<div class="layui-input-inline">
											<input type="text" id="id_ContractlistproName"
												name="ContractlistproName" value="${proContract.proName}" style="border: 0px;width:280px"
												readonly="readonly" class="layui-input">
										</div>
									</div>

								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">对外下浮前金额（元）</label>
										<div class="layui-input-inline">
											<input type="text" id="amountbefore" name="outPreDownAmount"
												value="${proContract.proContractInvest.outPreDownAmount}"
												style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">对外下浮率（%）</label>
										<div class="layui-input-inline">
											<input type="text" id="discount" value="${proContract.proContractInvest.outPreDownRate}"
												name="outPreDownRate" style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">对外下浮后金额（元）</label>
										<div class="layui-input-inline">
											<input type="text" id="amountafter" name="outAfterDownAmount"
												value="${proContract.proContractInvest.outAfterDownAmount}"
												style="border: 0px;" readonly="readonly" class="layui-input">
										</div>
									</div>
								</div>
							</fieldset>
							<fieldset class="layui-elem-field layui-field-title fieldset"
								style="text-align: center; cursor: default;">
								<div style="padding-top: 15px;">&nbsp;</div>
								<div class="layui-form-item">
									<shiro:hasPermission name="ADD_PROCONTRACT">
										<a class="layui-btn layuiadmin-btn-admin " data-type="add"
											id=id_addNewsubitems> <i
											class="layui-icon layui-icon-add-1 layuiadmin-button-btn"></i>新增子项
										</a>
									</shiro:hasPermission>
								</div>
								<div class="contract-list"></div>
							</fieldset>
							<fieldset class="layui-elem-field layui-field-title fieldset"
								id="contract-sync-info"
								style="text-align: center; cursor: default; display: none;">
								<div style="padding-top: 15px;">&nbsp;</div>
								<div class="layui-form-item">
									<shiro:hasPermission name="ADD_PROCONTRACT">
										<a class="layui-btn layuiadmin-btn-admin " data-type="add"
											id="contract-sync">同步至合同信息</a>
									</shiro:hasPermission>
								</div>

							</fieldset>
						</div>
					</div>
				</div>
				<div class="layui-form-item" style="position: fixed ! important; right: 30px; bottom: 45%; z-index: 10000;">
					<div class="layui-input-block">
						<button class="layui-btn layui-bg-blue layui-btn-normal layui-btn-lg  layui-btn-radius"
							type="button" lay-submit lay-filter="addInfo_form_submit"
							id="addInfo_form_submit">
							<i class="layui-icon layui-icon-ok layuiadmin-button-btn"></i>
							提交
						</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
</html>
<script>
	String.prototype.toInt = function () {
		if(this==''){
			return 0;
		}
		return parseInt(this);
	}
	Number.prototype.toMoney = function () {
		var m = Math.pow(10, 2);
		return Math.round(this * m) / m;
	}
	String.prototype.format = function () {
		var model = arguments;
	    return this.replace(/\{(\d+)\}/g, function (s, i) { 
	        return model[i];
	    });
	}
	var $contractList, $contractBreakdown, $contractSync, $contractSyncInfo, $addNewsubitems;	
	var proName;
	var proNameid;
	//静态资源路径前缀
	var staticPath = '${fileHttpPre}';
	var stateJSON = <infopub:dicJson groupNo="A00010028" />;
	layui.config({
				base : '${ctx}/resources/layuiadmin/' //静态资源所在路径
			})
			.extend({
				index : 'lib/index' //主入口模块
			})
			.use(['index', 'set', 'upload', 'element', 'laydate' ], function() {
						var $ = layui.$, form = layui.form, element = layui.element, laydate = layui.laydate, upload = layui.upload;
						// 正则校验
						form.verify({
							//验证汉字
						    CHS:[
						    	/^[\u0391-\uFFE5]+$/
						    	,'只能输入汉字'
						  	],
						  	//名字校验
						  	COC: [
								/^[\u4e00-\u9fa5_a-zA-Z0-9]+$/
								,'请输入正确的名称'
						  	],
						  	//大于0的正整数
						  	intNumber:[
								/^[1-9]\d*$/
								,'请输入正确的数字'
						  	],
						  	//数字只能有两位小数
						  	floatNumber:[
								/^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
								,'请输入正确的数字'
						  	],
						  	telNumber:[/^[1][3,4,5,7,8,9][0-9]{9}$/
								  		,'请输入正确的号码'
							],
						  	//数字大于0，并只能有两位小数
						  	floatAmount:[
								/^([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
								//var pattern=/^((\d+\.\d*[1-9]\d{1})|(\d*[1-9]\d*\.\d{2}))$/; 
								,'请输入正确的数字'
						  	]
						});
						
						var fileFormatWord = 'application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document';
						var fileFormatPdf = 'application/pdf';
						var fileFormat = 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf';
						uploadRender(1, upload,fileFormatWord, $);
						uploadRender(2, upload,fileFormatPdf, $);
						uploadRender(3, upload,fileFormat, $);
						uploadRender(4, upload,fileFormat, $);
						laydate.render({
		                    elem: '#sent-laydate-start',trigger:'click'
		                });
						laydate.render({
		                    elem: '#id_completionDateOfConstructionAndinstallation',trigger:'click'
		                });
						laydate.render({
		                    elem: '#id_operationEndDate',trigger:'click'
		                });
						checkValueVerifycontractCommencementDate(laydate,$);
						element.on('tab(docDemoTabBrief)', function(data) {
							var index = this.getAttribute('lay-id');
							TabSwitchTo(index,$);								
						});
						
						var id = $("#id_code").val();
						$.ajax({
							type : "POST", //提交方式  
							url : "${ctx}/proContract/getProContractById",//路径  
							data : { "proCodeAndCodes" : id
							},//数据，这里使用的是Json格式进行传输  
							success : function(result) {//返回数据根据结果进行相应的处理 					
								if (result.flag == true) {
									var details =result.proContractVo.proContractSubVos;
									if(details!=null&&details!=''&&details.length>0){
										var hash = {},subList=[];		
										for(var k=0;k<details.length;k++){
											for(var i = 0, j = details[k].proContractDetails.length; i < j; i++) {												
											    var e = details[k].proContractDetails[i];						
											    if(typeof(hash[e.contractSubId])=='undefined'){
													hash[e.contractSubId] = subList.length;							
													subList.push({
															itemNameSub:details[k].subName,
															sub:e.contractSubId,
															amountBeforeSub:details[k].outPreDownAmount,
															discountSub:details[k].outPreDownRate,
															amountAfterSub:details[k].outAfterDownAmount,									
															list:[{
																subRowId :e.orderIdx.indexOf(',')!=-1?e.orderIdx.split(',')[1]:e.orderIdx,
																costType : e.typeName.indexOf(',')!=-1?e.typeName.split(',')[1]:e.typeName,
																amountBefore : e.outPreDownAmount,
																discount : e.outPreDownRate,
																amountAfter : e.outAfterDownAmount
														}]});
												}else{								
													var index =  hash[e.contractSubId].toString().toInt();
													subList[index].list.push({
														subRowId :e.orderIdx.indexOf(',')!=-1?e.orderIdx.split(',')[1]:e.orderIdx,
														costType : e.typeName.indexOf(',')!=-1?e.typeName.split(',')[1]:e.typeName,
														amountBefore : e.outPreDownAmount,
														discount : e.outPreDownRate,
														amountAfter : e.outAfterDownAmount
													});					
												}						
											}										
											subRender($,subList);
										}											
									}
									form.render();
								}
							}
						});					
					  (function($) {
						    $.fn.inputTotal = function() {
						        var sum = 0;       
						        this.each(function() {
						            var thisNum = $(this);
						            var val = !!thisNum.val()?thisNum.val():0;
						            var num = parseFloat(val);
						            sum = setDecimalPlaces(sum +  num, 2);
						        });
						        return sum;
						    };
						 })($);
					  
						var $contractList=$('.contract-list'), 
						$contractBreakdown=$('#contract-breakdown'),
						$contractSync=$('#contract-sync'),
						$contractSyncInfo=$('#contract-sync-info'),
						$addNewsubitems=$("#id_addNewsubitems");	
						
						$contractBreakdown.click(function(){
							element.tabChange('docDemoTabBrief', 1);
						});						  
						$contractSync.click(function(){
							syncContract($); 
							var flag = true;
							var subName = $("input[name='subNames']").val();
							if(subName==''){
								layer.msg('请输入子项名称，子项名称不能为空！');
								flag = false;
								return false;
							}
							
							if(flag){
								$("input[name='outPreDownAmountDetials']").each(function(){
						            if($(this).val()==''){
						            	layer.msg('请输入对外下浮前金额，子项对外下浮前金额不能为空！');
						            	flag = false;
						            	return false;
						            }
						        })
							}
							if(flag){
								$("input[name='outPreDownRateDetials']").each(function(){
						        	if($(this).val()==''){
						        		layer.msg('请输入对外下浮率，子项对外下浮率不能为空！');
						        		flag = false;
						            	return false;
						            }
						        })
							}
							if(flag){
								$("input[name='typeNames']").each(function(){
						        	if($(this).val()==''){
						        		layer.msg('请输入政府代付费子项名称，子项名称不能为空！');
						        		flag = false;
						            	return false;
						            }
						        })
							}	
					        if(flag){
					        	layer.msg('已同步至合同信息',{icon: 1});
								element.tabChange('docDemoTabBrief', 0);
					        }
							
						});						
						$addNewsubitems.click(function() {
							var tempHtml = $('#layui-row').html().replace(/\{0\}/g,eightS4());
							$contractList.append(tempHtml);	
							if($contractSyncInfo.css('display')=='none'){
								$contractSyncInfo.css('display','');
							}
						});						
						$contractList.on('click','.del-layui-row',function(){
							var $layrow = $(this).parents('.layui-row');	
							layui.layer.confirm('确定删除子项？', {
										icon : 3,
										title : '提示'
									},function(index) {
										$layrow.remove();
										layui.layer.close(index);
										if ($contractSyncInfo.css('display') == 'block') {
											//$contractSyncInfo.css('display', 'none');
										}
										
										['amountbefore','amountafter'].forEach(function(e){
											var $total = $('#'+e);
											var total = $(".contract-list input[type=text][id$='"+e+"']").inputTotal();
											$total.val(total);
										});
								        var amountBefore = $("tr[id$='Row-1']").find('.amountbefore').inputTotal(),amountAfter = $("tr[id$='Row-1']").find('.amountafter').inputTotal();    
										var discount = getPercentage(amountAfter,amountBefore,true);
										$('#discount').val(discount);
							});													
						}).on('click','.add-sub-row',function(){
							addSubRow(this);
						}).on('blur','.layui-row input.subNames',function(){
							var $this = $(this);
							var $itemNameSubInputs = $this.parents('div.layui-row').find('input.itemNameSub');
							$itemNameSubInputs.val(this.value);							
							
						}).on('click','.del-sub-row',function(){
							deleteSubRow(this);
						}).on('keyup','.decimal',function(){
							 var val = this.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');
							 var val2 = val.replace(/[^0-9.]/g, "");
							 this.value = val2;
						}).on('blur','.contract-money input[type=text]:not([readonly])',function(){							
							var $tr = $(this).parents('tr');
							var $amountBefore = $tr .find(".amountbefore");
							var $amountAfter = $tr .find(".amountafter");
							var $discount = $tr .find(".discount");	
							
							var amountBefore = $amountBefore.val();
							var amountAfter = $amountAfter.val();
							var discount = $discount.val();
							discount = discount?parseFloat(discount):0;
							
							var amountAfter = amountBefore * (1-discount/100);							
							$amountAfter.val(amountAfter.toFixed(2));							
							
							var type,id;
							type = $(this).prop('class').replace('layui-input','').replace('decimal','').trim();
							id = $tr.prop("id");
							if(!$(this).hasClass("typeNames") && !$(this).hasClass("discount")){
								arabiaToCN(this,1);
							}
							parentGroup($,type,id);			
						});
						
						form.on('submit(addInfo_form_submit)',function (data) {
							syncContract($); 
							form.render();
		                	$("#addInfo_form_submit").removeAttr("lay-submit").removeClass("layui-bg-blue").addClass("layui-btn-disabled");
		              		layer.load();
		                   	//提交 Ajax 成功后，静态更新表格中的数据
		                   	console.log($('#addInfo_form').serialize());
		                   	$.ajax({
		                       	type : 'post',
		            			url : basePath + '/proContract/save',
		                       	data: $('#addInfo_form').serialize(),
		            			success:function(result){
		            				if(result.success){
		            					layer.closeAll('loading'); //关闭loading
		            					layer.msg('提交单据成功~',{icon: 1});
		            					//两秒后关闭当前页面
		            					setTimeout(function(){
		            						/**
		            						 * 查找父菜单，并刷新
		            						 */
		            						var topDoc = $(window.top.document);
		            						var path = basePath + '/proContract/list';
		            						// 获取页面名称
		            						var name = topDoc.find(".layui-nav-item [lay-href^='" + path + "']").text();
		            						if(name == '' || name == null){
		            							name = '项目合同';
		            						}
		            						window.parent.layui.index.openTabsPage(path, name);
		            						var iframe = window.parent.layui.admin.tabsBody(window.parent.layui.admin.tabsPage.index).find(".layadmin-iframe");
		            						iframe[0].contentWindow.location.reload(true);
		            						
		            						/**
		            						 * 关闭当前页
		            						 */
		            						var currPath = basePath + '/proContract/toCopy';
		            						var layid = topDoc.find("li[lay-id^='" + currPath + "']").attr('lay-id');
		            						window.parent.layui.element.tabDelete('layadmin-layout-tabs', layid);//关闭当前页
		            				        }, 2000);
		            				}else{
		            					layer.closeAll('loading'); //关闭loading
		              					$("#addInfo_form_submit").removeClass("layui-btn-disabled").addClass("layui-bg-blue").attr("lay-submit","");
		            					layer.msg(result.msg,{icon: 7});
		            			  	}
		            			}
		                   	});

		                });
		            });

	
	function subRender($,subList){
		form = layui.form;
		var $contractList=$('.contract-list');
		$contractList.empty();
		var $contractSyncInfo=$('#contract-sync-info');
		$contractSyncInfo.css('display','none');
		
		for (var i = 0, j = subList.length; i < j; i++) {
			var sl = subList[i];
			var itemNameSub = sl.itemNameSub,subId = sl.sub;
			var tempHtml = $('#layui-row').html().format(subId,itemNameSub);
			var $html = $(tempHtml);
			
			$html.find('#'+subId+'subName').val(sl.itemNameSub);
			$html.find('#'+subId+'amountbefore').val(sl.amountBeforeSub);
			$html.find('#'+subId+'discount').val(sl.discountSub);
			$html.find('#'+subId+'amountafter').val(sl.amountAfterSub);			
			subList[i].list.forEach(function(e) {
						var subRowId = e.subRowId;
						var costType = e.costType;
						var amountBefore = e.amountBefore;
						var discount = e.discount;	
						var amountAfter = e.amountAfter;	

						
						var $row = (subRowId.indexOf('.') == -1) ? $html .find('#' + subId + 'Row-' + subRowId) : $html.find('tr[id="sub' + subId + 'Row-' + subRowId + '"]');
						if ($row.length == 1) {
							$row.find('input[type="hidden"]:eq(0)').val(subRowId);
							var $typeNames = $row.find('td:eq(1) input.typeNames');											
							if ($typeNames.val() != costType) {																			
								$typeNames.val(costType);
							}
							$row.find('td:eq(1) input.itemNameSub').val(itemNameSub);
							$row.find('td:eq(2) input:first').val(amountBefore);
							$row.find('td:eq(3) input:first').val(discount);
							$row.find('td:eq(4) input:first').val(amountAfter);
						} else {
							var arr = subRowId.split('.');
							var level = arr.length;
							if (level == 2||level == 3) {					
								var id = "sub"+subId+"Row-"+subRowId;									
								var types = subRowId.split('.');        
						        var feeTypes = types[0],feeSmallTypes = types[0]+'.'+types[1];						        												
								var $trHtml = $($('#layui-row-tr').html().format(id,level,subRowId,subId,costType,amountBefore,discount,feeTypes,feeSmallTypes,itemNameSub,amountAfter));
								var pop = arr.pop();
								var parent = arr.length==1? subId + 'Row-' + arr[0]:"sub" + subId + "Row-" + arr.join('.');
								
								var siblings = (parent.indexOf('sub')==-1?'sub':'') + parent + '.';
								var $parent = $html.find("tr[id='" + parent + "']");
								var $siblings = $html.find("tr[id^='" + siblings + "']");
								var siblingslen = $siblings.length;										
								if(arr[0]=='1'){
									$trHtml.find('td:eq(3) input:first').prop('type','text');
								}
								
								
								if (siblingslen > 0) {
									var $last = $($siblings[siblingslen - 1]);
									var lastId = $last.prop('id');
									if (lastId.split('.').pop() == pop - 1) {												
										$last.after($trHtml);														 
									}								
								} else if ($parent.length == 1 && pop == '1') {
									$parent.after($trHtml);setReadonly($parent);
								}
							}
						}
			});
			$contractList.append($html);
			if ($contractSyncInfo.css('display') == 'none') {
				$contractSyncInfo.css('display', 'block');
			}
		}
		form.render();
	}
	
	function TabSwitchTo(index,$) {
		if (index == 0) {

		}
		if (index == 1) {
			TabSwitchTo1($);
		}
	}
	function TabSwitchTo1($) {
		var proName = $("#add_select_proId").val();
		if (proName != null) {
			$("#id_ContractlistproName").attr("value", proName);
		}
	}
    var uploadRender = function(id,upload,fileFormat,$) {
        upload.render({
                elem : '#' + id + '-upload-more',
                url : basePath
                    + '/proContract/uploadAtt/',
                data : {
                    types : id
                },
                multiple : true,
                accept : 'file',
                acceptMime : fileFormat,
                before : function(obj) {
                    layer.load();
                },
                done : function(res) {
                    if (res.code > 0) {
                        layer.closeAll('loading');
                        return layer.msg(res.msg, {
                            icon : 7
                        });
                    }
                    if (res.entity != null
                        && res.entity.length > 0) {
                        for ( var i in res.entity) {
                            var proContract = res.entity[i];
                            var arr = proContract
                                .split("|");
                            var imgSrc = "";
                            var suffix = arr[1]
                                .substring(
                                    arr[1]
                                        .lastIndexOf(".") + 1,
                                    arr[1].length);
                            if (suffix == 'jpg'
                                || suffix == 'png') {
                                imgSrc = "${fileHttpPre}/"
                                    + arr[3];
                            } else {
                                imgSrc = "${ctx}/resources/images/"
                                    + suffix
                                    + ".jpg";
                            }
                            $(
                                '#'
                                + id
                                + '-upload-more-list')
                                .append(
                                    '<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''
                                    + "${fileHttpPre}"
                                    + arr[3]
                                    + '\');">查看</a><a href="javascript:void(0)" onclick="del(\''
                                    + arr[2]
                                    + '\')";>删除</a></div><p>'
                                    + arr[1]
                                    + '</p><input type="hidden" value="'+proContract+'" id="fileAtt_'+arr[2]+'" name="fileAtts'+id+'" ></input></div>');
                        }
                    }
                },
                allDone : function(obj) {
                    layer.closeAll('loading');
                },
                error : function() {
                    layer.closeAll('loading');
                    layer.msg("上传失败，请稍后再试~", {
                        icon : 7
                    });
                }
            });
    }
  	//删除文件
	function del(index){
		layui.$("#fileAtt_"+index).remove();
		layui.$("#upload_img_"+index).remove();
	}
  
	//根据url查看文件
	function showImg(url){
		var openWin = window.open(url,'','left=410,height=768, width=1024, top=200,  toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
	}
	var getPercentage = function(a,b,d){
		var quotient = Number(b)!=0? a/b:0;
		if(d==true){
			return setDecimalPlaces((1-quotient)*100,2);
		}
		return setDecimalPlaces(quotient*100,2);
	}
    var setDecimalPlaces = function(f, digit) { 
        var m = Math.pow(10, digit); 
        return Math.round(f * m) / m;
    }  
	function formatNum(num) {
	    var str = num.toString();
	    if (-1 == str.indexOf(".")) {
	        str = str + ".00"
	    }
	    if (-1 != str.indexOf(",")) {
	        str = str.replace(new RegExp(',', "g"), "")
	    }
	    var intSum = str.substring(0, str.indexOf(".")).replace(/\B(?=(?:\d{3})+$)/g, ',');
	    var dot = str.substring(str.length, str.indexOf("."));
	    var ret = intSum + dot;
	    return ret;
	}
	function syncContract($){
		var data=[{
		code:"jagcf",
		title:"建安工程费",
		titleCss:"",
		value:$("tr[id$='Row-1'] input[type=text].amountafter").inputTotal(),
		displayOrder:"1",
		dbName:'caeFee'
		},
		{
		code:"jaxfl",
		title:"*建安下浮率（综合）",
		titleCss:"margin-lt10",
		value:$("#discount").val(),
		displayOrder:"",
		dbName:'caeDownRate'
		},
		{
		code:"jazb",
		title:"*建安占比",
		titleCss:"margin-lt10",
		value:"",
		displayOrder:"",
		dbName:'caeRate'
		},
		{
		code:"ybf",
		title:"预备费",
		titleCss:"",
		value:$("tr[id$='Row-2'] input[type=text].amountafter").inputTotal(),
		displayOrder:"2",
		dbName:'prepareFee'
		},
		{
		code:"jsgcqtf",
		title:"建设工程其他费",
		titleCss:"",
		value:$("tr[id$='Row-3'] input[type=text].amountafter").inputTotal(),
		displayOrder:"3",
		dbName:'buildOtherFee'
		},
		{
		code:"jsdwglf",
		title:"建设单位管理费",
		titleCss:"",
		value:$("tr[id$='Row-3.1'] input[type=text].amountafter").inputTotal(),
		displayOrder:"3.1",
		dbName:'buildOrgFee'
		},
		{
		code:"zfdff",
		title:"政府代付费",
		titleCss:"",
		value:$("tr[id$='Row-3.2'] input[type=text].amountafter").inputTotal(),
		displayOrder:"3.2",
		dbName:'gdReplaceFee'
		},
		{
		code:"xmqqf",
		title:"项目前期费",
		titleCss:"",
		value:$("tr[id$='Row-3.3'] input[type=text].amountafter").inputTotal(),
		displayOrder:"3.3",
		dbName:'preFee'
		},
		{
		code:"zdcqf",
		title:"征地拆迁费",
		titleCss:"",
		value:$("tr[id$='Row-3.3.1'] input[type=text].amountafter").inputTotal(),
		displayOrder:"3.3.1",
		dbName:'moveFee'
		},
		{
		code:"jsqlx",
		title:"建设期利息",
		titleCss:"",
		value:$("tr[id$='Row-4'] input[type=text].amountafter").inputTotal(),
		displayOrder:"4",
		dbName:'buildInterest'
		},
		{
		code:"sbjgqjgz",
		title:"设备及工器具购置",
		titleCss:"",
		value:$("tr[id$='Row-5'] input[type=text].amountafter").inputTotal(),
		displayOrder:"5",
		dbName:'buyFee'
		},
		{
		code:"pdldzj",
		title:"铺底流动资金",
		titleCss:"",
		value:$("tr[id$='Row-6'] input[type=text].amountafter").inputTotal(),
		displayOrder:"6",
		dbName:'flowFee'
		},
		{
		code:"tzhj",
		title:"投资合计",
		titleCss:"",
		displayOrder:"",
		value:"",
		dbName:'totalSum'
		}];
		var $contractInvestmentInfoPanel = 	$("#contract-investment-info .layui-form-item:nth-child(n+2)");$contractInvestmentInfoPanel.remove();
		var template = [],countField = {};
		for(var i=0,j=data.length;i<j;i++){
		    var item = data[i];
			var html=[];		
			if(i==j-1){
				html.push('<div class="layui-form-item" ><hr class="layui-bg-gray" ></div>');
				item.value = countField['jagcf']+ countField['ybf']+ countField['jsgcqtf']+ countField['jsqlx']+ countField['sbjgqjgz']+ countField['pdldzj'];
				item.value = parseFloat(item.value).toMoney();
			}
			countField[item.code]=item.value;			
			var fmtval = item.code!='jaxfl'?formatNum(item.value):item.value+"%"
			html.push('<div class="layui-form-item" >');
			html.push('<div class="layui-inline"   	><label class="layui-form-label" >'+item.displayOrder+'</label><div class="layui-input-inline" ></div></div>');
			html.push('<div class="layui-inline"  	><label class="layui-form-label '+item.titleCss+'">'+item.title+'</label><div class="layui-input-inline"> </div></div>');
			html.push('<div class="layui-inline"  	><label class="layui-form-label">'+fmtval+'</label><div class="layui-input-inline"><input type="hidden" id="'+item.code+'" name="'+item.dbName+'" value="'+item.value+'"  ></div></div>');
			html.push('</div>');
			template.push(html.join(''));
		}
		$('#contract-investment-info').html(template.join(''));
		var q = getPercentage(countField['jagcf'],countField['tzhj']);
		$('#jazb').val(q).parent().prev().text(q+'%');
		$("#contract-investment-info .layui-form-item:nth-child(n+2)").css('display','block');
	}
	
	function parentGroup($,type,id){
		var jianan = id.indexOf('-1.')!=-1;
		if(type=='amountbefore' && jianan==false){
			amountParentGroup($,'amountbefore',id);
			amountParentGroup($,'amountafter',id);
			countTopRows($,['amountbefore','amountafter']);
		}
		if(type=='amountbefore' && jianan==true){
			amountParentGroup($,'amountbefore',id);
			amountParentGroup($,'amountafter',id);			
			countTopRows($,['amountbefore','amountafter']);
			discountParentGroup($,id);
		}
		if(type=='discount' && jianan==true){
			amountParentGroup($,'amountafter',id);			
			countTopRows($,['amountafter']);
			discountParentGroup($,id);
		}
	}
	
	function countTopRows($,types){		
		$(".contract-list").find('.layui-row').each(function(){
			var id = $(this).attr('id');
			types.forEach(function(e){
				var $total = $('#'+id+e);
				var total = $("tr[id^='"+id+"Row'] ."+e).inputTotal();
				$total.val(total);
			});				
		});
		types.forEach(function(e){
			var $total = $('#'+e);
			var total = $(".contract-list input[type=text][id$='"+e+"']").inputTotal();
			$total.val(total);
		});
	}
	
	function discountParentGroup($,id){		
		var discount = function($tr){
			if($tr){
				var $amountBefore = $tr.find(".amountbefore");
				var $amountAfter = $tr.find(".amountafter");
				var $discount = $tr.find(".discount");	     		
				var amountBefore = $amountBefore.val();
				var amountAfter = $amountAfter.val();
				var discount = getPercentage(amountAfter,amountBefore,true);
				$discount.val(discount);
			}
		}
    	var arr = id .split('.');
    	if(arr.length==3){
			var item = arr.slice(0,2);
			var trId = item.join('.');             
			discount($("[id='"+trId+"']"));			     						
        }
        var trId = arr[0].replace('sub','');
        discount($("#"+trId));
        
        var subId = arr[0].replace(/^sub(.*)Row.*$/,'$1');
        $('#'+subId+'discount').val($('#'+subId+'Row-1').find('.discount').val());        
        var amountBefore = $("tr[id$='Row-1']").find('.amountbefore').inputTotal(),amountAfter = $("tr[id$='Row-1']").find('.amountafter').inputTotal();    
		var discount = getPercentage(amountAfter,amountBefore,true);
		$('#discount').val(discount);
	}
	
	function amountParentGroup($,type,id){
    	var arr = id.split('.');      
        if(arr.length==3){
			var item = arr.slice(0,2);
			var trId = item.join('.');
			var $tr = $('[id="'+trId+'"]');			
			$tr.find('.'+type).val($("tr[id^='"+trId+".'][level=3]").find('.'+type).inputTotal());			
        }       
        if(arr.length>=2){
            var trId = arr[0].replace('sub','');
        	var $tr = $('[id="'+trId+'"]');
    		$tr.find('.'+type).val($("tr[id^='"+arr[0]+".'][level=2]").find('.'+type).inputTotal());	
        }		
	}
	
    function eightS4() {
        function S4() {
            return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
        }
        return (S4()+S4()+""+S4()+""+S4()+""+S4()+""+S4()+S4()+S4()).toLocaleUpperCase();
    }
    
	function deleteSubRow(t) {
        var $ = layui.$;
        layui.layer.confirm('确定删除？', {
            icon: 3,
            title: '提示'
        }, function (index) {        	
            var $tr = $(t).parents('tr');
            var id = $tr.prop("id");    
            var level = $tr.attr("level");     
            var arr = id.split('.');
            arr.pop();            
            var prefix = arr.join('.')+ '.';
            
            var $waitRemove = $('tr[id="`"], tr[id^="`."]'.replace(/`/g,id));
            if(level=='2'){                
                var waitRemoveLast = $waitRemove[$waitRemove.length-1];             
                var waitRemoveLastId = $(waitRemoveLast).prop("id");     
                var waitRemoveLastIndex = null;
                $("tr[id^='" + prefix + "']").each(function(index){ 
                	if(this.id == waitRemoveLastId){
                		waitRemoveLastIndex = index;
                		return false;
                	}            	
                });
                $("tr[id^='" + prefix + "']:gt("+ waitRemoveLastIndex +")").each(function(index){    
                	if($(this).attr('level')=='3'){
                		var temp = this.id.split('-');
                		var numList = temp[1].split('.');
                		numList[1]=parseInt(numList[1])-1;
                		var subRowId = numList.join('.');
                		var nextId = temp[0]+'-'+subRowId;
                		var types = subRowId.split('.');        
                        var feeSmallTypes=types[0]+'.'+types[1];
                		$(this).attr('id', nextId).find(".label").text(subRowId)
                		.end().find("input[type=hidden]:first").val(subRowId)
                		.end().find("input[type=hidden].feeSmallTypes").val(feeSmallTypes);
                	}            	
                });                
            }           
            $waitRemove.remove();      
            

            var $subRows = $("tr[id^='" + prefix + "'][level="+level+"]");
            var rowId = prefix.split('-')[1];
            $subRows.each(function (index) {
                var sortid = index + 1
                var subRowId = rowId  + sortid;
                var nextId = prefix  + sortid;
                                                
                var types = subRowId.split('.');        
                var feeSmallTypes = types[0]+'.'+types[1];                
                $(this).attr('id', nextId).find(".label").text(subRowId)
                .end().find("input[type=hidden]:first").val(subRowId)
                .end().find("input[type=hidden].feeSmallTypes").val(feeSmallTypes);
            });            
            if($subRows.length==0){
            	var $parentRow = null; 
            	if(arr.length==1){
            		$parentRow = $('#'+arr[0].replace('sub',''));
            	}
            	if(arr.length==2){
            		$parentRow = $('[id="' + arr.join('.')+'"]');
            	}
            	removeReadonly($parentRow);            	
            }  
            parentGroup($,'amountbefore',id);
            layui.layer.close(index);            
        });
    }	
	
	function removeReadonly($t) {
		if ($t) {
			$t.find('input[type=text].amountbefore').removeProp('readonly').attr('lay-verify','required');
			$t.find('input[type=text].discount').removeProp('readonly').attr('lay-verify','required');
		}
	}
	function setReadonly($t) {
		if ($t) {
			$t.find('input[type=text].amountbefore').prop('readonly', true).removeAttr('lay-verify');
			$t.find('input[type=text].discount').prop('readonly', true).removeAttr('lay-verify');
		}
	}

    function addSubRow(t) {
        var $ = layui.$;
        var $parentRow = $(t).parents('tr');
        var level= parseInt($parentRow.attr('level'))+1;
        var parentId = $parentRow.attr('id');
        var subParentId = parentId.indexOf('sub')==0?parentId+'.':'sub'+parentId+'.';
        var $subRows = $("tr[id^='" + subParentId + "']");
        var $lastRow =($subRows.length > 0)? $("tr[id^='" + subParentId + "']:last"):$parentRow; 
        var arr = $lastRow.attr('id').split('.');
        
        var count = $subRows.length > 0?arr[parentId.split('.').length]-0:0;   
        var subId = subParentId.replace(/^sub(.*)Row.*$/,'$1');
        count++;
        var nextId = subParentId + count;
        var subRowId = nextId.split('-')[1];
        var html = [],types = subRowId.split('.');        
        var feeTypes = types[0],feeSmallTypes = types[0]+'.'+types[1];
        var itemNameSub = $lastRow.find('.itemNameSub').val();
        
        html.push('<tr id=' + nextId + '  level='+level+' >');
        html.push('<td><span class="label" >' + subRowId + '</span><input type="hidden" value="' + subRowId + '" name="orderIdxs" /><input type="hidden" value="' + subRowId + '" name="xv" /><input type="hidden" value="' + subId + '" name="contractSubId" /></td>');
        html.push('<td><input type="text" lay-verify="required" maxlength="50" value="" autocomplete="off" class="layui-input " name="typeNames"  /><input type="hidden" value="' + feeTypes + '" name="feeTypes" class="feeTypes" /><input type="hidden" value="' + feeSmallTypes + '" name="feeSmallTypes" class="feeSmallTypes" /><input type="hidden" value="'+itemNameSub+'" name="itemNameSub" class="itemNameSub" /></td>');
        html.push('<td><input type="text" lay-verify="required" value="" name="outPreDownAmountDetials" autocomplete="off" class="layui-input decimal amountbefore" /></td>');
        
        if(subParentId.indexOf('-1.')==-1){
        	html.push('<td><input type="hidden" value="0" name="outPreDownRateDetials" class="discount" /></td>');
        }else{
        	html.push('<td><input type="text" name="outPreDownRateDetials" autocomplete="off" class="layui-input decimal discount" /></td>');
        }
        
        html.push('<td><input type="text" readonly name="outAfterDownAmountDetials" autocomplete="off" class="layui-input amountafter" /></td>');
        html.push('<td>');        
        html.push('<button type="button" class="layui-btn layui-btn-sm del-sub-row"   ><i class="layui-icon">&#xe640;</i></button>');        
        if(nextId.split('.').length<3){
            html.push('<button type="button" class="layui-btn layui-btn-sm add-sub-row" ><i class="layui-icon">&#xe654;</i></button>');            
        }
        html.push('</td>'); 
        html.push('</tr>');
                
        var medalHtml = html.join('');
        $lastRow.after(medalHtml);
        setReadonly($parentRow);
        layui.form.render();
    }

	//合同开工日期
	function checkValueVerifycontractCommencementDate(laydate,$) {
		var Data_id_contractCommencementDate = laydate
				.render({
					elem : '#id_contractCommencementDate',trigger:'click',
					done : function(value, date) {
						var valueContractconstructionperioddays = $("#id_Contractconstructionperioddays").attr(
								"value");//合同建设期（天）
						var valueTotalcontractperioddays = $(
								"#id_Totalcontractperioddays").attr("value");//总合同期（天）
						var rgx = /^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;
						
						if (rgx.test(valueContractconstructionperioddays)) {//'请输入正确数字，且保留两位小数！'
							var nextday1 = addDate(value,
									valueContractconstructionperioddays);
							$("#id_completionDateOfConstructionAndinstallation")
									.attr("value", nextday1);//建安竣工日期
						}
						if (rgx.test(valueTotalcontractperioddays)) {//'请输入正确数字，且保留两位小数！'
							var nextday2 = addDate(value,
									valueTotalcontractperioddays);
							$("#id_operationEndDate").attr("value", nextday2);//运营结束日期
						}

					}
				});
	}

	/**
	 * [dateAddDays 从某个日期增加n天后的日期]
	 * @param  {[string]} dateTemp  [日期字符串]
	 * @param  {[int]} days [增加的天数]
	 * @return {[string]}[增加n天后的日期字符串]
	 */
	 function addDate(dateTemp, days) {
	    var nDate = new Date(dateTemp);
	    var millSeconds = Math.abs(nDate) + (days * 24 * 60 * 60 * 1000);
	    var rDate = new Date(millSeconds);
	    var year = rDate.getFullYear();
	    var month = rDate.getMonth() + 1;
	    month = month < 10 ? "0"+month : month;
	    var date = rDate.getDate();
	    date = date < 10 ? "0"+date : date;
	    return (year + "-" + month + "-" + date);
	}
	// 请输入正确数字，且保留两位小数！
	function checkValueverifyNumber2(obj) {
		var $ = layui.$, form = layui.form
		if (obj.value == '' || obj.value == null) {
			return;
		}
		var rgx = /^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;

		var boolrgx = rgx.test(obj.value);// true 
		var periodDays = parseFloat(obj.value)*365;
		//判断合同建设期是否有小数点，有则需加一天
		if(parseFloat(periodDays) > parseFloat((periodDays+"").split(".")[0])){
			periodDays = parseFloat((periodDays+"").split(".")[0]) + 1;
		}
		if (boolrgx) {
			if (obj.id == "id_Contractconstructionperiodyear") {//合同建设期（年）				
				$("#id_Contractconstructionperioddays").attr("value",periodDays);//合同建设期（天）
			} else if (obj.id == "id_Contractoperationperiodyear") {//合同运营期（年）
				$("#id_Contractoperationperioddays").attr("value",periodDays);//合同运营期（天）
			} else if (obj.id == "id_Totalcontractperiodyear") {//总合同期（年）
				$("#id_Totalcontractperioddays").attr("value", periodDays);//总合同期（天）
			}
		} else {
			obj.value =0;
			layer.msg('请输入正确数字，且保留两位小数！');
		}
	}
	//'请输入正确数字，且保留两位小数！'
	function isNumberAndFloat2(str) {
		var $ = layui.$, form = layui.form
		if (str.value == '' || str.value == null) {
			return;
		}
		var rgx = /^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;

		var boolrgx = rgx.test(str.value);// true 
		if (boolrgx) {
			return true;
		} else {
			str.value =0;
			layer.msg('请输入正确数字，且保留两位小数！');
			return false;
		}
	}
	function isNumberAndFloat3(){
		var $ = layui.$
		var rgx = /^([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;
		var bankFund = $("#bankFundId").val();
		var selfFund = $("#selfFundId").val();
		var gdFund = $("#gdFundId").val();
		
		if(bankFund ==''||bankFund ==null){
			bankFund = 0;
			$("#bankFundId").val(0);
		}
		if(rgx.test(bankFund)==false){
			$("#bankFundId").val(0);
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		if(selfFund ==''||selfFund ==null){
			selfFund = 0;
			$("#selfFundId").val(0);
		}
		if(rgx.test(selfFund)==false){
			$("#selfFundId").val(0);
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		if(gdFund ==''||gdFund ==null){
			gdFund = 0;
			$("#gdFundId").val(0);
		}
		if(rgx.test(gdFund)==false){
			$("#gdFundId").val(0);
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		if(bankFund==0&&selfFund==0&&gdFund==0){
			$("#bankFundPercentId").val(0);
			$("#selfFundPercentId").val(0);
			$("#gdFundPercentId").val(0);
		}else{
			var total = parseFloat(bankFund) +  parseFloat(selfFund) + parseFloat(gdFund);
			var bankFundPercent = (bankFund/total)*100;
			var selfFundPercent = (selfFund/total)*100;
			var gdFundPercent = (gdFund/total)*100;
			
			if(bankFund==0&&selfFund==0&&gdFund!=0){
				$("#bankFundPercentId").val(0);
				$("#selfFundPercentId").val(0);
				$("#gdFundPercentId").val(gdFundPercent.toFixed(2));	
			}else if(selfFund==0&&gdFund==0&&bankFund!=0){
				$("#selfFundPercentId").val(0);
				$("#gdFundPercentId").val(0);
				$("#bankFundPercentId").val(bankFundPercent.toFixed(2));
			}else if(bankFund==0&&gdFund==0&&selfFund!=0){
				$("#bankFundPercentId").val(0);
				$("#gdFundPercentId").val(0);
				$("#selfFundPercentId").val(selfFundPercent.toFixed(2));
			}else if(bankFund==0&&selfFund!=0&&gdFund!=0){
				$("#bankFundPercentId").val(0);
				$("#selfFundPercentId").val(selfFundPercent.toFixed(2));
				$("#gdFundPercentId").val(gdFundPercent.toFixed(2));
			}else if(selfFund==0&&bankFund!=0&&gdFund!=0){
				$("#selfFundPercentId").val(0);
				$("#bankFundPercentId").val(bankFundPercent.toFixed(2));
				$("#gdFundPercentId").val(gdFundPercent.toFixed(2));
			}else if(gdFund==0&&bankFund!=0&&selfFund!=0){
				$("#gdFundPercentId").val(0);
				$("#selfFundPercentId").val(selfFundPercent.toFixed(2));
				$("#bankFundPercentId").val(bankFundPercent.toFixed(2));			
			}else{
				$("#bankFundPercentId").val(bankFundPercent.toFixed(2));
				$("#selfFundPercentId").val(selfFundPercent.toFixed(2));
				$("#gdFundPercentId").val(gdFundPercent.toFixed(2));			
			}
		}
	}
</script>